#!/bin/bash

# Copyright (c) 2020 Teradici Corporation
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

INSTALL_DIR="/root"

apt-get -qq update
apt install -y awscli dos2unix python3

echo "--> Downloading required files from the bucket..."
aws s3 cp s3://${bucket_name}/${provisioning_script} $INSTALL_DIR

echo "--> Allowing scripts to be executable files..."
chmod +x $INSTALL_DIR/${provisioning_script}

echo "--> Ensuring line endings for downloaded files are in Unix format..."
dos2unix $INSTALL_DIR/${provisioning_script}

echo "--> Executing provisioning script..."
$INSTALL_DIR/${provisioning_script}
